const url = require('url');

var strUrl = '//www.lagou.com/a/b?name=zhangsan&age=20';

// var rs = url.parse(strUrl, true, true)

var params = {
  protocol: 'https:',
  host: 'www.lagou.com',
  port: '8080',
  hostname: 'www.lagou.com',
  hash: '#position',
  search: '?name=zhangsan&age=20',
  pathname: '/a',
}

rs = url.format(params)

console.log(rs);

console.log(url.resolve(rs, '../c/'))